A perspective page may want to offer links back to various pages offered by the Core GUI. To do this it may need some help in generating the proper link given only some contextual information. Embedding hard links is brittle as the perspective has no control over the Core GUI implementation and the paths could change.
For example, at the end of a wizard the perspective may want to offer some "next step" links. Or, a perspective page for, say, provisioning a particular group or resource may want to navigate to that new resource.
The proposal is to add API to the PerspectiveManagerRemote to generate urls in two ways:
-
Extension urls
-
Target urls
Extension Urls
The Core Perspective offers a rich set of extensions linked to Core GUI endpoints. The proposal is to allow API access to extension urls via the extension name, and required context. The API does not explicitly block access to extensions provided by non-core perspectives, although the need to access them is not obvious.
It's possible the user could navigate to the provided links manually; the core menu, resource tabs and perhaps other extensions may be currently displayed, but this still may allow a perspective to make the links available in a more logical flow, or bypass several clicks. And it is certainly possible that a user may be able to jump directly from "main" page content to , say, a resource page.
Following are rough approximations of what some of the API may look like. (also, see note at bottom of page about referencing actual API).
/**
* This can be used to navigate to the same link as defined by a core menu item. (note - we'll probably want to doc the menu item names offered by the
* core perspective.)
*/
getMenuUrl( Subject subject, String menuItemName )
/**
* This can be used to navigate to the specified tab for the specified resource. (note - we'll probably want to doc the tab names offered by the
* core perspective.)
*/
getResourceUrl( Subject, String resourceTabName, int resourceId )
/**
-
This can be used to assemble a url not otherwise obtainable via the API. This should
-
be used with care.
*
-
@return the Core GUI root url. For example, "http://host:port/"
*/
getRootUrl( Subject subject )
More calls can be added as more extension points are created.
Target Urls
The extension urls offer navigation to well-defined areas of the core GUI. Target Urls allow navigation to a specific "target". A target typically being something with a specific Id. A resource, an alert def, a user, role, etc.
This allows perspectives to link immediately to something created or referenced in the perspective page.
Initial Implementation
Please give feedback based on the initial API impl!
The initial implementation of the API is done and can be inspected by looking at PerspectiveManagerRemote.java. This link currently is set to the linux-config branch, after a merge it should move to master.